package z.explorer;

import java.util.List;

import javax.swing.JDialog;
import javax.swing.JFrame;

import z.explorer.core.task.Task;
import z.explorer.core.task.TaskTree;
import z.explorer.core.task.dao.TaskDAO;
import z.explorer.core.task.dao.TaskTreeDAO;
import z.explorer.ui.*;
import z.explorer.ui.common.ZTablePanel;
import z.explorer.ui.component.walker.ZWalker;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import z.test.*;

public class Main {

	private static Log log = LogFactory.getLog(Main.class);
	public static ApplicationContext context = null;

	private static void setWindowStyle() {
		JFrame.setDefaultLookAndFeelDecorated(true);
		JDialog.setDefaultLookAndFeelDecorated(true);
	}

	private synchronized static void initContext() {
		context = new ClassPathXmlApplicationContext("application.xml");
	}
	
	static{
		setWindowStyle();
		initContext();
	}

	public static void main(String[] args) {
		
		Explorer zExplorer = (Explorer) context.getBean("zExplorer");
		zExplorer.init();
		log.info("zExplorer start up now...");
		
		// AccountDAO accountDao=(AccountDAO)context.getBean("accountDAO");
		// Account a=accountDao.find(2);

		// TaskTreeDAO taskTreeDao = (TaskTreeDAO)
		// context.getBean("taskTreeDAO");
		// List<TaskTree> taskTree_list = taskTreeDao.searchAll();
		// for (int i = 0; i < taskTree_list.size(); i++) {
		// System.out.println("parent:" + taskTree_list.get(i).getParent_id());
		// System.out.println("son:" + taskTree_list.get(i).getSon_id());
		// }

	}

}
